/**
 * 
 */
package org.dbwebx.persistence;

import javax.persistence.Entity;
import javax.persistence.Table;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * The concrete {@link DBUnit} JCR implementation. 
 * @author Izzet_Mustafayev
 *
 */
@Entity
@Table(name = "t_dbunits_jcr")
public class JCRDBUnit extends DBUnit {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 1093476025970L;

	/**
	 * The JCR Node path.
	 */
	private String path;

	/**
	 * The JCR Node type.
	 */
	private String type;

	/**
	 * @return the path
	 */
	public String getPath() {
		return path;
	}

	/**
	 * @param path
	 *            the path to set
	 */
	public void setPath(final String path) {
		this.path = path;
	}

	/**
	 * @return the type
	 */
	public String getType() {
		return type;
	}

	/**
	 * @param type
	 *            the type to set
	 */
	public void setType(final String type) {
		this.type = type;
	}

	@Override
	public String toString() {
		return new ToStringBuilder(this).append(identity).append(name).append(
				path).append(type).toString();
	}

	@Override
	public boolean equals(final Object obj) {
		if (obj instanceof JCRDBUnit == false) {
			return false;
		}

		if (this == obj) {
			return true;
		}

		JCRDBUnit rhs = (JCRDBUnit) obj;

		return new EqualsBuilder().append(identity, rhs.identity).append(name,
				rhs.name).append(path, rhs.path).append(type, rhs.type)
				.isEquals();
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder(11, 47).append(identity).append(name)
				.append(path).append(type).toHashCode();
	}

}
